/*   1:    */ package org.jetbrains.jps.model.impl;
/*   2:    */ 
/*   3:    */

import com.intellij.openapi.util.Comparing;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.model.*;
import org.jetbrains.jps.model.ex.JpsElementChildRoleBase;
import org.jetbrains.jps.model.ex.JpsElementCollectionRole;
import org.jetbrains.jps.model.impl.runConfiguration.JpsRunConfigurationImpl;
import org.jetbrains.jps.model.library.JpsLibrary;
import org.jetbrains.jps.model.library.JpsLibraryCollection;
import org.jetbrains.jps.model.library.JpsLibraryType;
import org.jetbrains.jps.model.library.impl.JpsLibraryCollectionImpl;
import org.jetbrains.jps.model.library.impl.JpsLibraryRole;
import org.jetbrains.jps.model.module.JpsModule;
import org.jetbrains.jps.model.module.JpsModuleType;
import org.jetbrains.jps.model.module.JpsSdkReferencesTable;
import org.jetbrains.jps.model.module.JpsTypedModule;
import org.jetbrains.jps.model.module.impl.JpsModuleImpl;
import org.jetbrains.jps.model.module.impl.JpsModuleRole;
import org.jetbrains.jps.model.module.impl.JpsSdkReferencesTableImpl;
import org.jetbrains.jps.model.runConfiguration.JpsRunConfiguration;
import org.jetbrains.jps.model.runConfiguration.JpsRunConfigurationType;
import org.jetbrains.jps.model.runConfiguration.JpsTypedRunConfiguration;

import java.util.List;

/*   4:    */
/*   5:    */
/*   6:    */
/*   7:    */
/*   8:    */
/*   9:    */
/*  10:    */
/*  11:    */
/*  12:    */
/*  13:    */
/*  14:    */
/*  15:    */
/*  16:    */
/*  17:    */
/*  18:    */
/*  19:    */
/*  20:    */
/*  21:    */
/*  22:    */
/*  23:    */
/*  24:    */
/*  25:    */
/*  26:    */
/*  27:    */
/*  28:    */
/*  29:    */
/*  30:    */
/*  31:    */
/*  32:    */ 
/*  33:    */ public class JpsProjectImpl
/*  34:    */   extends JpsRootElementBase<JpsProjectImpl>
/*  35:    */   implements JpsProject
/*  36:    */ {
/*  37: 46 */   private static final JpsElementCollectionRole<JpsElementReference<?>> c = JpsElementCollectionRole.create(JpsElementChildRoleBase.create("external reference"));
/*  38: 48 */   private static final JpsElementCollectionRole<JpsRunConfiguration> d = JpsElementCollectionRole.create(JpsElementChildRoleBase.create("run configuration"));
/*  39:    */   private final JpsLibraryCollection e;
/*  40: 50 */   private String f = "";
/*  41:    */   
/*  42:    */   public JpsProjectImpl(@NotNull JpsModel paramJpsModel, JpsEventDispatcher paramJpsEventDispatcher)
/*  43:    */   {
/*  44: 53 */     super(paramJpsModel, paramJpsEventDispatcher);
/*  45: 54 */     this.myContainer.setChild(JpsModuleRole.MODULE_COLLECTION_ROLE);
/*  46: 55 */     this.myContainer.setChild(c);
/*  47: 56 */     this.myContainer.setChild(JpsSdkReferencesTableImpl.ROLE);
/*  48: 57 */     this.myContainer.setChild(d);
/*  49: 58 */     this.e = new JpsLibraryCollectionImpl((JpsElementCollection)this.myContainer.setChild(JpsLibraryRole.LIBRARIES_COLLECTION_ROLE));
/*  50:    */   }
/*  51:    */   
/*  52:    */   public JpsProjectImpl(JpsProjectImpl paramJpsProjectImpl, JpsModel paramJpsModel, JpsEventDispatcher paramJpsEventDispatcher)
/*  53:    */   {
/*  54: 62 */     super(paramJpsProjectImpl, paramJpsModel, paramJpsEventDispatcher);
/*  55: 63 */     this.e = new JpsLibraryCollectionImpl((JpsElementCollection)this.myContainer.getChild(JpsLibraryRole.LIBRARIES_COLLECTION_ROLE));
/*  56:    */   }
/*  57:    */   
/*  58:    */   @NotNull
/*  59:    */   public String getName()
/*  60:    */   {
/*  61: 69 */     String tmp4_1 = this.f;
/*  62: 69 */     if (tmp4_1 == null) {
/*  63: 69 */       throw new IllegalStateException(String.format("@NotNull method %s.%s must not return null", new Object[] { "org/jetbrains/jps/model/impl/JpsProjectImpl", "getName" }));
/*  64:    */     }
/*  65: 69 */     return tmp4_1;
/*  66:    */   }
/*  67:    */   
/*  68:    */   public void setName(@NotNull String paramString)
/*  69:    */   {
/*  70: 74 */     if (paramString == null) {
/*  71: 74 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "0", "org/jetbrains/jps/model/impl/JpsProjectImpl", "setName" }));
/*  72:    */     }
/*  73: 74 */     if (!Comparing.equal(this.f, paramString))
/*  74:    */     {
/*  75: 75 */       this.f = paramString;
/*  76: 76 */       fireElementChanged();
/*  77:    */     }
/*  78:    */   }
/*  79:    */   
/*  80:    */   public void addExternalReference(@NotNull JpsElementReference<?> paramJpsElementReference)
/*  81:    */   {
/*  82: 81 */     if (paramJpsElementReference == null) {
/*  83: 81 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "0", "org/jetbrains/jps/model/impl/JpsProjectImpl", "addExternalReference" }));
/*  84:    */     }
/*  85: 81 */     ((JpsElementCollection)this.myContainer.getChild(c)).addChild(paramJpsElementReference);
/*  86:    */   }
/*  87:    */   
/*  88:    */   @NotNull
/*  89:    */   public <P extends JpsElement, ModuleType extends JpsModuleType<P>,  extends JpsElementTypeWithDefaultProperties<P>> JpsModule addModule(@NotNull String paramString, @NotNull ModuleType paramModuleType)
/*  90:    */   {
/*  91: 89 */     if (paramString == null) {
/*  92: 89 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "0", "org/jetbrains/jps/model/impl/JpsProjectImpl", "addModule" }));
/*  93:    */     }
/*  94: 89 */     if (paramModuleType == null) {
/*  95: 89 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "1", "org/jetbrains/jps/model/impl/JpsProjectImpl", "addModule" }));
/*  96:    */     }
/*  97: 89 */     JpsElementCollection localJpsElementCollection = (JpsElementCollection)this.myContainer.getChild(JpsModuleRole.MODULE_COLLECTION_ROLE); JpsModule 
/*  98: 90 */       tmp124_121 = ((JpsModule)localJpsElementCollection.addChild(new JpsModuleImpl(paramModuleType, paramString, (JpsElement)((JpsElementTypeWithDefaultProperties)paramModuleType).createDefaultProperties())));
/*  99: 90 */     if (tmp124_121 == null) {
/* 100: 90 */       throw new IllegalStateException(String.format("@NotNull method %s.%s must not return null", new Object[] { "org/jetbrains/jps/model/impl/JpsProjectImpl", "addModule" }));
/* 101:    */     }
/* 102: 90 */     return tmp124_121;
/* 103:    */   }
/* 104:    */   
/* 105:    */   @NotNull
/* 106:    */   public <P extends JpsElement, LibraryType extends JpsLibraryType<P>,  extends JpsElementTypeWithDefaultProperties<P>> JpsLibrary addLibrary(@NotNull String paramString, @NotNull LibraryType paramLibraryType)
/* 107:    */   {
/* 108: 97 */     if (paramString == null) {
/* 109: 97 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "0", "org/jetbrains/jps/model/impl/JpsProjectImpl", "addLibrary" }));
/* 110:    */     }
/* 111: 97 */     if (paramLibraryType == null) {
/* 112: 97 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "1", "org/jetbrains/jps/model/impl/JpsProjectImpl", "addLibrary" }));
/* 113:    */     }
/* 114: 97 */     JpsLibrary tmp91_86 = this.e.addLibrary(paramString, paramLibraryType);
/* 115: 97 */     if (tmp91_86 == null) {
/* 116: 97 */       throw new IllegalStateException(String.format("@NotNull method %s.%s must not return null", new Object[] { "org/jetbrains/jps/model/impl/JpsProjectImpl", "addLibrary" }));
/* 117:    */     }
/* 118: 97 */     return tmp91_86;
/* 119:    */   }
/* 120:    */   
/* 121:    */   @NotNull
/* 122:    */   public List<JpsModule> getModules()
/* 123:    */   {
/* 124:103 */     List tmp18_13 = ((JpsElementCollection)this.myContainer.getChild(JpsModuleRole.MODULE_COLLECTION_ROLE)).getElements();
/* 125:103 */     if (tmp18_13 == null) {
/* 126:103 */       throw new IllegalStateException(String.format("@NotNull method %s.%s must not return null", new Object[] { "org/jetbrains/jps/model/impl/JpsProjectImpl", "getModules" }));
/* 127:    */     }
/* 128:103 */     return tmp18_13;
/* 129:    */   }
/* 130:    */   
/* 131:    */   @NotNull
/* 132:    */   public <P extends JpsElement> Iterable<JpsTypedModule<P>> getModules(JpsModuleType<P> paramJpsModuleType)
/* 133:    */   {
/* 134:109 */     Iterable tmp19_14 = ((JpsElementCollection)this.myContainer.getChild(JpsModuleRole.MODULE_COLLECTION_ROLE)).getElementsOfType(paramJpsModuleType);
/* 135:109 */     if (tmp19_14 == null) {
/* 136:109 */       throw new IllegalStateException(String.format("@NotNull method %s.%s must not return null", new Object[] { "org/jetbrains/jps/model/impl/JpsProjectImpl", "getModules" }));
/* 137:    */     }
/* 138:109 */     return tmp19_14;
/* 139:    */   }
/* 140:    */   
/* 141:    */   public void addModule(@NotNull JpsModule paramJpsModule)
/* 142:    */   {
/* 143:114 */     if (paramJpsModule == null) {
/* 144:114 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "0", "org/jetbrains/jps/model/impl/JpsProjectImpl", "addModule" }));
/* 145:    */     }
/* 146:114 */     ((JpsElementCollection)this.myContainer.getChild(JpsModuleRole.MODULE_COLLECTION_ROLE)).addChild(paramJpsModule);
/* 147:    */   }
/* 148:    */   
/* 149:    */   @NotNull
/* 150:    */   public JpsLibraryCollection getLibraryCollection()
/* 151:    */   {
/* 152:120 */     JpsLibraryCollection tmp4_1 = this.e;
/* 153:120 */     if (tmp4_1 == null) {
/* 154:120 */       throw new IllegalStateException(String.format("@NotNull method %s.%s must not return null", new Object[] { "org/jetbrains/jps/model/impl/JpsProjectImpl", "getLibraryCollection" }));
/* 155:    */     }
/* 156:120 */     return tmp4_1;
/* 157:    */   }
/* 158:    */   
/* 159:    */   @NotNull
/* 160:    */   public JpsSdkReferencesTable getSdkReferencesTable()
/* 161:    */   {
/* 162:126 */     JpsSdkReferencesTable tmp13_10 = ((JpsSdkReferencesTable)this.myContainer.getChild(JpsSdkReferencesTableImpl.ROLE));
/* 163:126 */     if (tmp13_10 == null) {
/* 164:126 */       throw new IllegalStateException(String.format("@NotNull method %s.%s must not return null", new Object[] { "org/jetbrains/jps/model/impl/JpsProjectImpl", "getSdkReferencesTable" }));
/* 165:    */     }
/* 166:126 */     return tmp13_10;
/* 167:    */   }
/* 168:    */   
/* 169:    */   @NotNull
/* 170:    */   public <P extends JpsElement> Iterable<JpsTypedRunConfiguration<P>> getRunConfigurations(JpsRunConfigurationType<P> paramJpsRunConfigurationType)
/* 171:    */   {
/* 172:132 */     Iterable tmp10_5 = a().getElementsOfType(paramJpsRunConfigurationType);
/* 173:132 */     if (tmp10_5 == null) {
/* 174:132 */       throw new IllegalStateException(String.format("@NotNull method %s.%s must not return null", new Object[] { "org/jetbrains/jps/model/impl/JpsProjectImpl", "getRunConfigurations" }));
/* 175:    */     }
/* 176:132 */     return tmp10_5;
/* 177:    */   }
/* 178:    */   
/* 179:    */   @NotNull
/* 180:    */   public <P extends JpsElement> JpsTypedRunConfiguration<P> addRunConfiguration(@NotNull String paramString, @NotNull JpsRunConfigurationType<P> paramJpsRunConfigurationType, @NotNull P paramP)
/* 181:    */   {
/* 182:140 */     if (paramString == null) {
/* 183:140 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "0", "org/jetbrains/jps/model/impl/JpsProjectImpl", "addRunConfiguration" }));
/* 184:    */     }
/* 185:140 */     if (paramJpsRunConfigurationType == null) {
/* 186:140 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "1", "org/jetbrains/jps/model/impl/JpsProjectImpl", "addRunConfiguration" }));
/* 187:    */     }
/* 188:140 */     if (paramP == null) {
/* 189:140 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "2", "org/jetbrains/jps/model/impl/JpsProjectImpl", "addRunConfiguration" }));
/* 190:    */     }
/* 191:140 */     JpsTypedRunConfiguration tmp142_139 = ((JpsTypedRunConfiguration)a().addChild(new JpsRunConfigurationImpl(paramString, paramJpsRunConfigurationType, paramP)));
/* 192:140 */     if (tmp142_139 == null) {
/* 193:140 */       throw new IllegalStateException(String.format("@NotNull method %s.%s must not return null", new Object[] { "org/jetbrains/jps/model/impl/JpsProjectImpl", "addRunConfiguration" }));
/* 194:    */     }
/* 195:140 */     return tmp142_139;
/* 196:    */   }
/* 197:    */   
/* 198:    */   private JpsElementCollection<JpsRunConfiguration> a()
/* 199:    */   {
/* 200:144 */     return (JpsElementCollection)this.myContainer.getChild(d);
/* 201:    */   }
/* 202:    */   
/* 203:    */   @NotNull
/* 204:    */   public JpsElementReference<JpsProject> createReference()
/* 205:    */   {
/* 206:150 */     void tmp7_4 = new JpsProjectElementReference();
/* 207:150 */     if (tmp7_4 == null) {
/* 208:150 */       throw new IllegalStateException(String.format("@NotNull method %s.%s must not return null", new Object[] { "org/jetbrains/jps/model/impl/JpsProjectImpl", "createReference" }));
/* 209:    */     }
/* 210:150 */     return tmp7_4;
/* 211:    */   }
/* 212:    */ }



/* Location:           E:\idea\

 * Qualified Name:     org.jetbrains.jps.model.impl.JpsProjectImpl

 * JD-Core Version:    0.7.0.1

 */